package edu.tapestry.iddb.client.helpers;

import iddb.PluginIdentificator;

public class PI {

	PluginIdentificator ident;
	

	static String SEPARATOR = ";@";
	
	
	public PI(String input){
		String[] params = input.split(SEPARATOR);
		this.ident = new PluginIdentificator();
		int i = 0;
		this.ident.setUsername(params[i]);
		i++;
		this.ident.setType(params[i]);
		i++;
		this.ident.setSrvAddr(params[i]);
	}
	
	public PI(PluginIdentificator pi){
		this.ident = pi;
	}
	
	
	
	public PluginIdentificator getIdent(){
		return this.ident;
	}
	
	
	
	
	
	public String toString(){
		StringBuffer sb = new StringBuffer();
		
		sb.append(this.ident.getUsername());
		sb.append(SEPARATOR);
		sb.append(this.ident.getType());
		sb.append(SEPARATOR);
		sb.append(this.ident.getSrvAddr());
		
		return sb.toString();
	}
}
